/**

 */
define([
    'knockout', "jquery", "common"
], function (ko, $, Common) {
    'use strict';
    // represent a single todo item
    var Register = function (option) {
        var self = this;
        self.fetch = function (user, menuType) {
        	var supermenu = [
        		{
        			location: "#/pages/home/home", name: "首页", menustatus: "", icon: "fa-home", target: "portal",
        			children:null
        		},
        		{
        			location: "#/1", name: "系统配置", menustatus: "", icon: "fa-cubes", target: "portal",
        			children:[
        				{
        					location: "#/pages/super/manager", name: "管理员", menustatus: "", children: "", icon: "", target: "portal"
        				},
        				{
        					location: "#/pages/super/menurender", name: "菜单路由", menustatus: "", children: "", icon: "", target: "portal"
        				}
        			]
        		}
        	];
			var managemenu = [
				{
        			location: "#/1", name: "首页", menustatus: "", icon: "fa-home", target: "portal"
        		},
        		{
        			location: "#/1", name: "系统配置", menustatus: "", icon: "fa-cubes", target: "portal",
        			children:[
        				{
        					location: "#/pages/super/menurender", name: "菜单路由", menustatus: "", children: "", icon: "", target: "portal"
        				}
        			]
        		}
			];
            // 开发环境用全的菜单就可以了
            var fullmenu = [
                {
                    location: "#/1", name: "首页", menustatus: "", icon: "fa-home", target: "portal",
                    children: [
                        {
                            location: "#/pages/home/home", name: "采购商", menustatus: "", children: "", icon: "", target: "portal"
                        },
                        {
                            location: "#/pages/home/supplyhome", name: "供应商", menustatus: "", children: "", icon: "", target: "portal"
                        }
                    ]
                },
                {
                    location: "#/1", name: "920", menustatus: "", icon: "fa-home", target: "portal",
                    children: [
                        {
                            location: "#/pages/requirement/requirelist_new/0",
                            name: "采购需求",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/buyoffer/buyofferlist_new",
                            name: "询价管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/pricedecision/pdresultlist_new",
                            name: "定标",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]
                },
                {
                    location: "#/1", name: "寻源管理", menustatus: "", icon: "fa-search", target: "portal",
                    children: [
                        {
                            location: "#/pages/requirement/requirelist/0",
                            name: "采购需求-经理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/requirement/requirelist/1",
                            name: "采购需求-采购员",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/buyoffer/buyofferlist",
                            name: "询价管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/pricedecision/pdresultlist",
                            name: "定标",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]
                },
                {
                    location: "#/2", name: "采购执行", menustatus: "", icon: "fa-user", target: "portal",
                    children: [
                        {
                            location: "#/pages/order/purorder", name: "采购订单", menustatus: "", children: "", icon: "", target: "portal"
                        },
                        {
                            location: "#/pages/checkbiz/pu_checkbill_list",
                            name: "采购对账",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/checkbiz/pu_invoice_list",
                            name: "采购发票",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/order/puorderexec",
                            name: "订单执行查询",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/arriveorder/arriveorderlist",
                            name: "到货查询",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]
                },
                {
                    location: "#/3", name: "商机管理", menustatus: "", icon: "fa-hdd-o", target: "portal",
                    children: [
                        {
                            location: "#/pages/price/quotation", name: "报价", menustatus: "", children: "", icon: "", target: "portal"
                        }
                    ]
                },
                {
                    location: "#/5", name: "销售执行", menustatus: "", icon: "fa-shopping-cart", target: "portal",
                    children: [
                        {
                            location: "#/pages/saleorder/saleorderlist",
                            name: "销售订单",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/deliveryorder/deliveryorderlist",
                            name: "发货管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/coopbiz_billquery/purchaseinlist",
                            name: "销售入库",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/checkbiz/sale_checkbill_list",
                            name: "销售对账",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/checkbiz/sale_invoice_list",
                            name: "销售发票",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/4", name: "商品管理", menustatus: "", icon: "fa-clipboard", target: "portal",
                    children: [
                        {
                            location: "#/pages/product_manager/productlist",
                            name: "商品管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/product_manager/productclslist",
                            name: "商品分类",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/6", name: "物料管理", menustatus: "", icon: "fa-cubes", target: "portal",
                    children: [
                        {
                            location: "#/pages/material_manager/material",
                            name: "物料管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/material_manager/materialclass",
                            name: "物料分类",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/7", name: "账户中心", menustatus: "", icon: "fa-user", target: "portal",
                    children: [
                        {
                            location: "#/pages/organization_manager/organization",
                            name: "组织机构管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/admin_user/user",
                            name: "用户管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/8", name: "供应商管理", menustatus: "", icon: "fa-group", target: "portal",
                    children: [
                        {
                            location: "#/pages/pu_supplymgr/supplymgr",
                            name: "供应商档案",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/pu_supplymgr/supplyclass",
                            name: "供应商分类",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/supplymgr/supplyapplylist",
                            name: "我的申请单",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/supplymgr/supplyapprovelist",
                            name: "供应商审核",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/supplymgr/supplychangelist",
                            name: "变更申请",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                        ,
                        {
                            location: "#/pages/supplymgr/supplychangeapprovelist",
                            name: "变更审核",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/8", name: "内部商城", menustatus: "", icon: "fa-building-o", target: "portal",
                    children: [
                        {
                            location: "#/pages/product_manager/marketproductclslist",
                            name: "超市商品分类",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/allowsale/puallowlist",
                            name: "供货申请",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/allowsale/goodspublish",
                            name: "超市商品管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/8", name: "客户管理", menustatus: "", icon: "fa-user-plus", target: "portal",
                    children: [
                        {
                            location: "#/pages/allowsale/applylist",
                            name: "允销申请",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/allowsale/applycategory",
                            name: "云霄目录",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/8", name: "系统管理", menustatus: "", icon: "fa-cog", target: "portal",
                    children: [
                        {
                            location: "#/pages/uapprove/processlist",
                            name: "审批流设计",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/uapprove/synchronize",
                            name: "审批流用户同步",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                        ,
                        {
                            location: "#/pages/admin/erpconfig",
                            name: "erp对接配置",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "http://172.20.14.81/gwmanage/mygwapp/index",
                            name: "网关管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "http://172.20.14.81/gwmanage/mygwapp/seccenter",
                            name: "网关安全中心",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/admin_enterprise/enterprisemanage",
                            name: "企业信息管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/requirement/ali1688auth",
                            name: "1688授权登录",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/requirement/msgpush",
                            name: "1688消息处理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]

                },
                {
                    location: "#/9", name: "安全库存", menustatus: "", icon: "fa-cog", target: "portal",
                    children: [
                        {
                            location: "#/pages/inventory/inventorylist",
                            name: "库存管理",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        },
                        {
                            location: "#/pages/inventory/inventoryquery",
                            name: "库存查询",
                            menustatus: "",
                            children: "",
                            icon: "",
                            target: "portal"
                        }
                    ]
                }
            ];

            // 920路由
            /*window.router.addRouter('#/pages/buyoffer/buyofferlist_new')
            window.router.addRouter("#/pages/requirement/requirelist_new/:id");
            window.router.addRouter('#/pages/buyoffer/buyofferedit_new')
            window.router.addRouter('#/pages/pricedecision/pdresultlist_new')
            //额外的路由
            window.router.addRouter("#/pages/welcome/welcome");
            //定标页面路由
            window.router.addRouter("#/pages/supplymgr/supplychangelist");
            window.router.addRouter("#/pages/supplymgr/supplychangeapprovelist");
            window.router.addRouter("#/pages/pricedecision/pricedecision");
            window.router.addRouter("#/pages/admin_basedoc/annoucementplatpreview");
            window.router.addRouter("#/pages/price/buyOfferDetail");
            window.router.addRouter("#/pages/home/supplyhome");
            window.router.addRouter("#/pages/admin_user/user");
            window.router.addRouter("#/pages/admin_rbac/role");
            window.router.addRouter("#/pages/admin_rbac/resource");
            window.router.addRouter("#/pages/admin_menu/menu");
            window.router.addRouter("#/pages/admin/erpconfig");
            window.router.addRouter("#/pages/admin_enterprise/enterprise");
            window.router.addRouter("#/pages/admin_enterprise/enterprisemanage");
            window.router.addRouter("#/pages/admin_basedoc/measuredoc");
            window.router.addRouter("#/pages/admin_basedoc/bank");
            window.router.addRouter("#/pages/admin_basedoc/address");
            window.router.addRouter("#/pages/admin_basedoc/currency");
            window.router.addRouter("#/pages/admin_basedoc/invoice");
            window.router.addRouter("#/pages/admin_basedoc/announcementplat");
            window.router.addRouter("#/pages/admin_user/user");
            window.router.addRouter("#/pages/allowsale/applylist");
            window.router.addRouter("#/pages/allowsale/applycategory");
            window.router.addRouter("#/pages/allowsale/goodspublish");
            window.router.addRouter("#/pages/allowsale/puallowlist");
            window.router.addRouter("#/pages/allowsale/puapplycategory");
            window.router.addRouter("#/pages/arriveorder/arriveorderlist");
            window.router.addRouter("#/pages/buyoffer/buyofferlist");
            window.router.addRouter("#/pages/coopbiz_billquery/purchaseinlist");
            window.router.addRouter("#/pages/coopbiz_billquery/invoicelist");
            window.router.addRouter("#/pages/deliveryorder/deliveryorderlist");
            
            window.router.addRouter("#/pages/material/platmaterialclass");
            window.router.addRouter("#/pages/material_manager/materialclass");
            window.router.addRouter("#/pages/material_manager/material");
            window.router.addRouter("#/pages/material_manager/materialclassplat");
            window.router.addRouter("#/pages/order/purorder");
            window.router.addRouter("#/pages/order/puorderexec");
            window.router.addRouter("#/pages/arriveorder/arriveorderlist");
            window.router.addRouter("#/pages/organization_manager/organization");
            window.router.addRouter("#/pages/price/quotation");
            window.router.addRouter("#/pages/pricedecision/pcbuyofferlist");
            window.router.addRouter("#/pages/pricedecision/pdresultlist");
            window.router.addRouter("#/pages/product_manager/productclslist");
            window.router.addRouter("#/pages/product_manager/productlist");
            window.router.addRouter("#/pages/pu_supplymgr/supplymgr");
            window.router.addRouter("#/pages/pu_supplymgr/supplyclass");
            window.router.addRouter("#/pages/requirement/requirelist/:id");
            window.router.addRouter("#/pages/requirement/msgpush");
            window.router.addRouter("#/pages/requirement/ali1688auth");
            window.router.addRouter("#/pages/saleorder/saleorderlist");
            window.router.addRouter("#/pages/uapprove/synchronize");
            window.router.addRouter("#/pages/uapprove/processlist");
            window.router.addRouter("#/pages/product_manager/marketproductclslist");
            window.router.addRouter("#/pages/uapprove/processlist");
            window.router.addRouter("#/pages/checkbiz/pu_checkbill_list");
            window.router.addRouter("#/pages/checkbiz/pu_checkbill_card");
            window.router.addRouter("#/pages/checkbiz/pu_invoiceapply_list");
            window.router.addRouter("#/pages/checkbiz/pu_invoiceapply_card");
            window.router.addRouter("#/pages/checkbiz/pu_invoice_list");
            window.router.addRouter("#/pages/checkbiz/pu_invoice_card");
            window.router.addRouter("#/pages/godownentry/godownentry");
            //销售协同
            window.router.addRouter("#/pages/checkbiz/sale_checkbill_list");
            window.router.addRouter("#/pages/checkbiz/sale_checkbill_card");
            window.router.addRouter("#/pages/checkbiz/sale_invoice_list");
            window.router.addRouter("#/pages/checkbiz/sale_invoice_card");
            window.router.addRouter("#/pages/supplymgr/supplyapplylist");
            window.router.addRouter("#/pages/supplymgr/supplyapprovelist");
            //安全库存
            window.router.addRouter("#/pages/inventory/inventorylist");
            window.router.addRouter("#/pages/inventory/inventoryquery");*/
           window.router.addRouter("#/pages/home/home");
            console.info(user.userType);
            if(user.userType == 1){
            	//超级管理员
            	window.router.addRouter("#/pages/super/manager");
            	window.router.addRouter("#/pages/super/manageredit");
            	window.router.addRouter("#/pages/super/menurender");
            	return supermenu;
            }else if(user.userType == 2){
            	//管理员
            	window.router.addRouter("#/pages/super/menurender");
            	return managemenu;
            }else{
            	return fullmenu;
            }
        };
    };
    return Register;
});
